package top.ucat.x.p.service;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;
import top.ucat.box.starter.oauth.common.pojo.User;
import top.ucat.box.starter.oauth.common.service.UserAuthorizationService;
import top.ucat.x.system.service.provider.SystemUserService;

import java.util.Set;

/**
 * @Auther: Jun
 * @Date: 2020/4/25 11:31
 * @Description:
 */
public class UserAuthorizationServiceImpl implements UserAuthorizationService {

    @Reference
    private SystemUserService systemUserService;

    @Override
    public Set<String> getUserPermissionCodes(User user) {
        Set<String> permissionCodes = systemUserService.getUserPermissionCodes(user.getId());
        return permissionCodes;
    }

    @Override
    public Set<String> getUserRoles(User user) {
        Set<String> userRoles = systemUserService.getUserRoles(user.getId());
        return userRoles;
    }

    @Override
    public boolean isAdmin(User user) {
        return false;
    }
}
